// pages/home/home.js
Page({
cart:[],
  /**
   * 页面的初始数据
   */
  data: {
    productid:'',

    background:['https://s1.328888.xyz/2022/06/02/WJKAk.jpg','https://s1.328888.xyz/2022/06/02/WJnX3.jpg','https://s1.328888.xyz/2022/06/02/WJ1p4.jpg'],
    indicatorDots:true,
    vertical:false,
    autoplay:true,
    interval:3000,
    duration:500,
    classType:[
      {
        "id":1,
        "name":"当季必点"
      },{
        "id":2,
        "name":"山茶花茶"
      },{
        "id":3,
        "name":"鲜果奶茶"
      },{
        "id":4,
        "name":"人气奶茶"
      },{
        "id":5,
        "name":"活动商品"
      },{
        "id":6,
        "name":"鲜沏果茶"
      },{
        "id":7,
        "name":"现磨咖啡"
      }
    ],
    // 分类后的产品列表
    productList:[

    ],
    goodsData:[
      {
        "Title":"杨枝甘露（大）",
        "GoodsDescribe":"先剥先切鲜芒果，搭配醇厚椰乳，口味地道，浓郁清爽",
        "SaleAmount":19,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WehvT.jpg",
        "goodnumber":"101",
        "classid":"1"
      },{
        "Title":"杨枝甘露（中）",
        "GoodsDescribe":"先剥先切鲜芒果，特调椰奶，口味地道，浓郁清爽",
        "SaleAmount":17,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeqzM.jpg",
        "goodnumber":"102",
        "classid":"3"
      },{
        "Title":"鲜柠檬山茶花",
        "GoodsDescribe":"山茶花乌龙茶，口感酸酸甜甜，花香浓郁，新鲜的味道",
        "SaleAmount":10,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeD17.jpg",
        "goodnumber":"103",
        "classid":"2"
      },{
        "Title":"鲜草莓奶茶",
        "GoodsDescribe":"新鲜红颜草莓搭配山茶花，花香果香，芬芳馥郁",
        "SaleAmount":12,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeluX.png",
        "goodnumber":"104",
        "classid":"3"
      },{
        "Title":"葡萄多肉酪酪",
        "GoodsDescribe":"茶香清雅，果香怡人，芝士浓郁，三重美味，尽在一杯",
        "SaleAmount":18,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WetDZ.jpg",
        "goodnumber":"105",
        "classid":"4"
      },{
        "Title":"超级西瓜汁",
        "GoodsDescribe":"鲜甜西瓜，新鲜鲜榨西瓜，真材实料看得见；超大一杯，超级满足",
        "SaleAmount":15,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeWEg.jpg",
        "goodnumber":"106",
        "classid":"5"
      },{
        "Title":"生椰拿铁（中）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":15,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeC81.jpg",
        "goodnumber":"107",
        "classid":"5"
      },{
        "Title":"生椰拿铁（小）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":14,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WepRt.jpg",
        "goodnumber":"108",
        "classid":"6"
      },
      {
        "Title":"美式咖啡",
        "GoodsDescribe":"醒神必备！精选阿拉比卡优质咖啡豆现萃香醇，唤醒一天的好精神",
        "SaleAmount":11,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/We7LO.jpg",
        "goodnumber":"109",
        "classid":"7"
      },{
        "Title":"杨枝甘露（大）",
        "GoodsDescribe":"先剥先切鲜芒果，搭配醇厚椰乳，口味地道，浓郁清爽",
        "SaleAmount":19,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WehvT.jpg",
        "goodnumber":"101",
        "classid":"5"
      },{
        "Title":"杨枝甘露（中）",
        "GoodsDescribe":"先剥先切鲜芒果，特调椰奶，口味地道，浓郁清爽",
        "SaleAmount":17,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WehvT.jpg",
        "goodnumber":"102",
        "classid":"6"
      },{
        "Title":"鲜柠檬山茶花",
        "GoodsDescribe":"山茶花乌龙茶，口感酸酸甜甜，花香浓郁，新鲜的味道",
        "SaleAmount":10,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeD17.jpg",
        "goodnumber":"103",
        "classid":"3"
      },{
        "Title":"鲜草莓奶茶",
        "GoodsDescribe":"新鲜红颜草莓搭配山茶花，花香果香，芬芳馥郁",
        "SaleAmount":12,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeluX.png",
        "goodnumber":"104",
        "classid":"3"
      },{
        "Title":"葡萄多肉酪酪",
        "GoodsDescribe":"茶香清雅，果香怡人，芝士浓郁，三重美味，尽在一杯",
        "SaleAmount":18,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WetDZ.jpg",
        "goodnumber":"105",
        "classid":"2"
      },{
        "Title":"超级西瓜汁",
        "GoodsDescribe":"鲜甜西瓜，新鲜鲜榨西瓜，真材实料看得见；超大一杯，超级满足",
        "SaleAmount":15,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeWEg.jpg",
        "goodnumber":"106",
        "classid":"2"
      },{
        "Title":"生椰拿铁（中）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":15,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeC81.jpg",
        "goodnumber":"107",
        "classid":"2"
      },{
        "Title":"生椰拿铁（小）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":14,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WepRt.jpg",
        "goodnumber":"108",
        "classid":"5"
      },
      {
        "Title":"美式咖啡",
        "GoodsDescribe":"醒神必备！精选阿拉比卡优质咖啡豆现萃香醇，唤醒一天的好精神",
        "SaleAmount":11,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/We7LO.jpg",
        "goodnumber":"109",
        "classid":"1"
      },{
        "Title":"生椰拿铁（中）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":15,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeC81.jpg",
        "goodnumber":"107",
        "classid":"1"
      },{
        "Title":"生椰拿铁（小）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":14,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WepRt.jpg",
        "goodnumber":"108",
        "classid":"4"
      },
      {
        "Title":"美式咖啡",
        "GoodsDescribe":"醒神必备！精选阿拉比卡优质咖啡豆现萃香醇，唤醒一天的好精神",
        "SaleAmount":11,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/We7LO.jpg",
        "goodnumber":"109",
        "classid":"4"
      },
      {
        "Title":"生椰拿铁（小）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":14,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WepRt.jpg",
        "goodnumber":"108",
        "classid":"5"
      },
      {
        "Title":"美式咖啡",
        "GoodsDescribe":"醒神必备！精选阿拉比卡优质咖啡豆现萃香醇，唤醒一天的好精神",
        "SaleAmount":11,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/We7LO.jpg",
        "goodnumber":"109",
        "classid":"7"
      },{
        "Title":"生椰拿铁（中）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":15,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WeC81.jpg",
        "goodnumber":"107",
        "classid":"7"
      },{
        "Title":"生椰拿铁（小）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":14,
        "GoodsImage":"https://s1.328888.xyz/2022/06/02/WepRt.jpg",
        "goodnumber":"108",
        "classid":"7"
      }
    ]
  },
 

  searchTab(e){
    var p = this.data.goodsData;
    var id = e.currentTarget.id;
    var list= []
    for(var i= 0;i<p.length;i++){
      if(p[i].classid == id){
        list.push(p[i])
      }
    }
    this.setData({
      productList:list
    })
  },

      
    
  // 跳转到商品详情页面
  jumpDetail:function(e){
    
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      productid:options.id
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})